export const yearEchart = (data = {}) => {
  return {
    grid: {
      left: 50,
      right: 30,
      top: 30,
      bottom: 30
    },
    xAxis: {
      type: 'category',
      data: Object.keys(data),
      axisTick: {
        show: false
      },
      axisLine: {
        lineStyle: {
          color: '#c5c5c5'
        }
      }
    },
    yAxis: {
      type: 'value',
      axisTick: {
        show: false
      },
      axisLine: {
        lineStyle: {
          color: '#c5c5c5'
        }
      }
    },
    series: [{
      data: Object.values(data),
      type: 'bar',
      barWidth: 10,
      label: {
        show: true,
        position: 'top'
      },
      itemStyle: {
        color: 'rgb(255, 131, 164)',
        barBorderRadius: [5, 5, 0, 0]
      }
    }]
  }
}

export const monthEchart = (data = []) => {
  const x = []
  const y = []
  data.map((item, index) => {
    x.push(index + 1)
    y.push(item)
  })

  return {
    grid: {
      left: 50,
      right: 30,
      top: 30,
      bottom: 30
    },
    xAxis: {
      type: 'category',
      data: x,
      axisTick: {
        show: false
      },
      axisLine: {
        lineStyle: {
          color: '#c5c5c5'
        }
      }
    },
    yAxis: {
      type: 'value',
      axisTick: {
        show: false
      },
      axisLine: {
        lineStyle: {
          color: '#c5c5c5'
        }
      }
    },
    series: [{
      data: y,
      type: 'bar',
      barWidth: 10,
      label: {
        show: true,
        position: 'top'
      },
      itemStyle: {
        color: 'rgb(106, 206, 255)',
        barBorderRadius: [5, 5, 0, 0]
      }
    }]
  }
}
